package com.flute.framework.index;

import com.flute.tools.timer.FlexTimer;

public class TimerIndexer {
	private IIndexer indexer;
	private long updateInterval;

	public TimerIndexer(IIndexer indexer) {
		this.indexer = indexer;
	}

	public void start() {
		FlexTimer.getInstance().startTimer(indexer.getIndexerName(), indexer,
				"update", updateInterval, true);
	}

	public void startRebuild() {
		indexer.rebuildFrom(null);
	}

	public void stop() {
		FlexTimer.getInstance().stopTimer(indexer.getIndexerName());
	}

	public IIndexer getIndexer() {
		return indexer;
	}

	public void setIndexer(IIndexer indexer) {
		this.indexer = indexer;
	}

}
